package com.googlecode.allinclusive.fw.core.converter;

public class LongConverter implements Converter {

	@Override
	public Object convert(Object obj) {
		if (obj == null) {
			return null;
		}
		
		if (obj instanceof Long) {
			return (Long) obj;
		} else if (obj instanceof Number) {
			return ((Number) obj).longValue();
		} else {
			if (obj.toString().trim().equals("")) {
				return null;
			} else {
				return Long.parseLong(obj.toString().trim());
			}
		}
	}

}
